package com.hyacinth.dubbo.io.netty.client.console;

import com.hyacinth.dubbo.io.netty.protocol.request.GroupMessageRequestPacket;
import com.hyacinth.dubbo.io.netty.protocol.request.MessageRequestPacket;
import io.netty.channel.Channel;

import java.util.Scanner;

/**
 * @author zhangfb
 * @version 1.0.0.1
 * @since JDK 1.8
 */
public class SendToGroupConsoleCommand implements ConsoleCommand {

    @Override
    public void exec(Scanner scanner, Channel channel) {
        System.out.print("发送消息给某个某个群组：");

        String groupId = scanner.next();
        String message = scanner.next();

        channel.writeAndFlush(new GroupMessageRequestPacket(groupId, message));
    }
}
